package com.chap18;

import lombok.extern.slf4j.Slf4j;
import org.openjdk.jol.info.ClassLayout;

/**
 * <p>
 * <code>LockEscalationDemo</code>
 * </p>
 *
 * @author junbao3
 * TODO
 * @date 2023-05-17 16:29
 * Copyright (C) 2021 IFlyTek. All rights reserved.
 */
@Slf4j
public class LockEscalationDemo4 {
    public static void main(String[] args) throws InterruptedException {

       log.debug(ClassLayout.parseInstance(LockEscalationDemo4.class).toPrintable());//001 无锁  类对象是在jvm启动之前就存在了 不存在延迟偏向的问题
       synchronized (LockEscalationDemo4.class){
            log.debug(ClassLayout.parseInstance(LockEscalationDemo4.class).toPrintable());//00 轻量级锁
       }

    }
}
